package cn.kduck.webapp.user.web;

import cn.kduck.core.service.Page;
import cn.kduck.core.web.annotation.ModelOperate;
import cn.kduck.core.web.annotation.ModelResource;
import cn.kduck.core.web.json.JsonPageObject;
import cn.kduck.webapp.user.service.AccountUserService;
import cn.kduck.webapp.user.service.UserAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
@ModelResource("用户管理接口")
public class UserAccountController {

    @Autowired
    private AccountUserService accountUserService;

    @GetMapping("/list")
    @ModelOperate(name="用户列表查询",group = "view")
    public JsonPageObject listUser(Page page, @RequestParam Map<String,Object> paramMap){
//        AuthUser authUser = AuthUserHolder.getAuthUser();
//        System.out.println(authUser.getUsername());
        List<UserAccount> users = accountUserService.listUserAccount(paramMap, page);
        return new JsonPageObject(page,users);
    }
}
